package Test;

import Utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.jupiter.api.Test;

import java.util.List;

import static Test.Util.splitString;

public class tet {
    SqlSession sqlSession = MybatisUtils.getSqlSession();
    UserMapper usermapper = sqlSession.getMapper(UserMapper.class);
    @Test
    public void main(){
        for (int i=0;i<30;i++){
            usermapper.InsertIP(new User(i,"alim",(3*i*i+2*i+30)+"",(3*i*i+5*i+20)+""));
        }
//        System.out.println(usermapper.GetUserIPByNickname("alim"));
    }

    @Test
    public  void m() {
//        User alim = usermapper.VerifyUser(new User("alim", "391543"));
//        System.out.println(alim==null);
//        System.out.println("公网IP地址: " + getPublicIP());
//        usermapper.UPDATEIP(new User(6,"alim",getPublicIP(),"text1"));
        List<User> users = usermapper.GetFriend(new User(38, "alim", "alim", ""));
        for (User user:users){
            System.out.println(user.getNickname());
        }
    }
    @Test
    public void T(){
//        usermapper.AddFriend(usermapper.GetUserByNickName("alim").getUserID(),usermapper.GetUserByNickName("alim12345").getUserID());
        String s = usermapper.GetNickNameByIP("60.204.251.108");
        System.out.println(s);
    }


    public static void main(String[] args) {
        String input = "/60.204.251.108->nihao";


        List<String> strings = splitString(input);
        System.out.println(strings.get(0));
    }
}